﻿using System;
using System.Net.Sockets;
using System.Text;
using System.Net;
namespace Client
{
    class ClientStart
    {
        private const int port = 17333;
        static void Main(string[] args)
        {
            CreateUDPLient();
            Console.ReadKey();
        }

        static void CreateUDPLient() 
        {
            UdpClient client = new UdpClient();
            byte[] data = Encoding.ASCII.GetBytes("454654556");
            IPEndPoint remoteIp = new IPEndPoint(IPAddress.Parse("127.0.0.1"), port);
            client.Send(data, data.Length, remoteIp);

        }



        static void CreateTCPClient() 
        {
            try
            {
                var client = new TcpClient("127.0.0.1", port);
             NetworkStream ns=   client.GetStream();
                byte[] data = new byte[1024];
                int len = ns.Read(data,0,data.Length);
                Console.WriteLine(Encoding.ASCII.GetString(data, 0,len));
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
        
        }

    }
}
